﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace DarkAngels.WoW.Library.Armory.Character.tabs
{
    public class FeedTab : AbstractDataClass
    {
        public FeedTab(Character character)
        {
            m_char = character;
        }

        public override void Load()
        {
            LoadData();
        }

        private void LoadData()
        {
            XmlData = Character.Provider.GetFile(BuildUri(FileName));
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(XmlData);
        }

        public string XmlData
        {
            get;
            set;
        }

        private String FileName
        {
            get
            {
                if (Character._Loaded)
                    return String.Format("character-feed.atom?{0}", Character.CharUrl);
                else
                    return String.Format("character-feed.atom?r={0}&n={1}", Character.RealmName, Character.CharacterName);
            }
        }

        private Character m_char = null;
        public Character Character
        {
            get
            {
                return m_char;
            }
        }
    }
}
